package com.manor.main.http;

import com.manor.common.CommonAppConfig;
import com.manor.common.http.HttpCallback;
import com.manor.common.http.HttpClient;

/**

 * @version 1.0

 * @date 2020/4/24  16:41
 */
public class ShortHttpUtil {

    /**
     * 取消网络请求
     */
    public static void cancel(String tag) {
        HttpClient.getInstance().cancel(tag);
    }

//    /**
//     * 用于评论/回复 点赞数累计
//     */
//    public static void addSvCommentLike(String cId, HttpCallback callback) {
//        String uid = CommonAppConfig.getInstance().getUid();
//        String token = CommonAppConfig.getInstance().getToken();
//        String sign = MD5Util.getMD5(StringUtil.contact("commentid=", cId, "&uid=", uid, "&", HttpClient.SALT));
////        String sign = MD5Util.getMD5(StringUtil.contact("uid=", uid, "&token=", token, "&commentid=", cId, "&", HttpClient.SALT));
//        HttpClient.getInstance().get("Short.AddCommentLike", MainHttpConsts.ADD_COMMENT_LIKE)
//                .params("uid", CommonAppConfig.getInstance().getUid())
//                .params("token", CommonAppConfig.getInstance().getToken())
//                .params("commentid", cId)
//                .params("sign", sign)
//                .execute(callback);
//    }
//
//
//    /**
//     * 用于短视频点赞
//     */
//    public static void addSvAssist(String dId, HttpCallback callback) {
//        String uid = CommonAppConfig.getInstance().getUid();
//        String token = CommonAppConfig.getInstance().getToken();//"&token=", token,
//        String sign = MD5Util.getMD5(StringUtil.contact("dynamicid=", dId, "&uid=", uid, "&", HttpClient.SALT));
//        HttpClient.getInstance().get("Short.AddLike", MainHttpConsts.ADD_SV_ASSIST)
//                .params("uid", CommonAppConfig.getInstance().getUid())
//                .params("token", CommonAppConfig.getInstance().getToken())
//                .params("dynamicid", dId)
//                .params("sign", sign)
//                .execute(callback);
//    }
//
//    /**
//     * 用于用户删除短视频
//     */
//    public static void delSvVideo(String dId, HttpCallback callback) {
//        String uid = CommonAppConfig.getInstance().getUid();
//        String token = CommonAppConfig.getInstance().getToken();
//        String sign = MD5Util.getMD5(StringUtil.contact("uid=", uid, "&token=", token, "&dynamicid=", dId, "&", HttpClient.SALT));
//        HttpClient.getInstance().get("Short.DelDynamic", MainHttpConsts.DEL_SV_VIDEO)
//                .params("uid", CommonAppConfig.getInstance().getUid())
//                .params("token", CommonAppConfig.getInstance().getToken())
//                .params("dynamicid", dId)
//                .execute(callback);
//    }
//
//    /**
//     * 短视频评论列表
//     */
//    public static void getSvCommentList(String dId, int p, HttpCallback callback) {
//        HttpClient.getInstance().get("Short.GetComments", MainHttpConsts.GET_SV_COMMENT_LIST)
//                .params("uid", CommonAppConfig.getInstance().getUid())
//                .params("dynamicid", dId)
//                .params("p", p)
//                .execute(callback);
//    }


    /**
     * 视频计数
     */
    public static void addVideoStatistical(String vId, HttpCallback callback) {
        HttpClient.getInstance().get("Short.VideoFull", MainHttpConsts.GET_SV_COMMENT_LIST)
                .params("uid", CommonAppConfig.getInstance().getUid())
                .params("token", CommonAppConfig.getInstance().getToken())
                .params("dynamicid", vId)
                .execute(callback);
    }


    /**
     * 短视频列表
     */
    public static void getSvVideoList(String dId, int p, HttpCallback callback) {
        getSvVideoList(dId, p, "", "", callback);
    }

    public static void getSvVideoList(String dId, int p, String uids, String commentId, HttpCallback callback) {
        HttpClient.getInstance().get("Short.GetDynamicList", MainHttpConsts.GET_SV_COMMENT_LIST)
                .params("uid", CommonAppConfig.getInstance().getUid())
                .params("id", dId)
                .params("p", p)
                .params("uids", uids)
                .params("commentid", commentId)
                .execute(callback);
    }





}
